<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('操作日志详细')" />
	<th:block th:include="include :: jsonview-css" />
    <style>
        table td{
            max-width: 285px;
        }
    </style>
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m-t" id="form-requirement-edit">
		<input name="reqId" id="reqId" type="hidden" th:value="${requirement.reqId}">
        <div class="ibox">
            <div class="ibox-title">
                <span class="label label-primary pull-right" th:text="${@dict.getLabel('sys_req_type', requirement.reqType)}"></span>
                <h5 th:text="'编号：' + ${requirement.reqSerial}"></h5>
            </div>
            <div class="ibox-content">
                <h4>需求内容</h4>
                <p th:text="${requirement.reqContent}">
                </p>
                <div class="row  m-t-sm">
                    <div class="col-sm-4">
                        <div class="font-bold">提出时间</div>
                        <label th:text="${#dates.format(requirement.beginTime,'yyyy-MM-dd')}"></label>
                    </div>
                    <div class="col-sm-4">
                        <div class="font-bold">计划工作量</div>
                        <label th:text="${requirement.planDays}"></label>
                    </div>
                    <div class="col-sm-4 text-right">
                        <div class="font-bold">实际工作量</div>
                        <label th:text="${workload}"></label>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">更新状态：</label>
            <div class="col-sm-8">
                <div class="radio-box" th:each="dict : ${@dict.getType('sys_req_status')}">
                    <input type="radio" name="reqStatus" th:value="${dict.dictValue}" th:checked="${dict.dictValue==requirement.reqStatus}">
                    <label th:for="${'reqStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                </div>
            </div>
        </div>
	</form>
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table"></table>
		</div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: jsonview-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/record/";
        $(function() {
            var options = {
                showSearch: false,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                url: prefix + "recordByReq?reqId=" + $("#reqId").val(),
                columns: [
                    {
                        field: 'no',
                        title: '序号',
                        align: "center",
                        width: 40,
                        formatter: function (value, row, index) {
                            return index + 1;
                        }
                    },
                    {
                        field : 'workContent',
                        title : '工作内容'
                    },
                    {
                        field : 'userId',
                        title : '开发人',
                        align: "center",
                        formatter: function(value, row, index) {
                            var userName;
                            if(value!=null){
                                $.ajax({
                                    type:'post',
                                    url: '/system/user/getUsername',
                                    data:"userId="+value,
                                    async: false,
                                    success: function(data){
                                        var user= JSON.parse(data);
                                        userName = user.userName;
                                    }
                                });
                            }
                            return userName;
                        }
                    },
                    {
                        field : 'workDays',
                        title : '使用工作量',
                        align: "center"
                    },
                    {
                        field : 'markDate',
                        title : '记录日期',
                        align: "center",
                        formatter: function (value, row, index) {
                            return changeDateFormat(value);
                        }
                    }
                    ]
            };
            $.table.init(options);
        });

        //转换日期格式(时间戳转换为datetime格式)
        function changeDateFormat(cellval) {
            if (cellval != null) {
                var date = new Date(cellval);
                var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
                var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();

                var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
                var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
                var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();

                return date.getFullYear() + "-" + month + "-" + currentDate + " " + hours + ":" + minutes;
            }
        }
        /* 添加用户-选择用户-提交 */
        function submitHandler() {
            $.operate.save("/system/requirement/edit", $('#form-requirement-edit').serialize());
        }

	</script>
	<style>
	pre{
	white-space: pre-wrap!important;
	word-wrap: break-word!important;
	*white-space:normal!important;
	}
	</style>
</body>
</html>